set scheme s1color 

use TeO, clear

// Religiosity: Average of standardized religion-related items
foreach x in relimp r_ostent r_miam r_impedu r_culte {
	sum `x', det
	gen `x'_st=(`x'-r(mean))/r(sd)
}

egen avg_rel=rowmean(relimp_st r_ostent_st r_miam_st r_impedu_st r_culte_st)

// Standardize identity outcomes
foreach x in feelfbpl feelfrench feelmorefor seenasfrench homeinfrance {
	qui sum `x'
	local `x'm=r(mean)
	sum `x' 
	local sd=r(sd)
	gen `x'st=(`x'-``x'm')/`sd'  
}

//Regressions
local sample if bpl=="1101" &female==1  
local inter interm 
local controls i.birthyear i.religion tmuslim 
estimates clear

reg seenasfrenchst `controls' `inter' `sample'&fbpl!=1101  &mbpl!=1101, cl(religion)
eststo m1

reg homeinfrancest `controls' `inter' `sample'&fbpl!=1101  &mbpl!=1101, cl(religion)
eststo m2

reg feelfrenchst `controls' `inter' `sample'&fbpl!=1101  &mbpl!=1101, cl(religion)
eststo m3

reg feelfbplst `controls' `inter' `sample'&fbpl!=1101  &mbpl!=1101, cl(religion)
eststo m4

reg avg_rel `controls' `inter' `sample', cl(religion)
eststo m5



// Graph
coefplot (m1, aseq("Seen as French") ciopts(lcolor(black) recast(rcap))) ///
(m2, aseq("Feel at home in France") ciopts(lcolor(black) recast(rcap))) ///
(m3, aseq("Feel French") ciopts(lcolor(black) recast(rcap))) ///
(m4, aseq("Feel [father's nationality]") ciopts(lcolor(black) recast(rcap))) ///
(m5, aseq("Religiosity") ciopts(lcolor(black) recast(rcap))), ci(90) xline(0) keep(interm) ///
plotregion(style(none)) ysca(titlegap(2)) msize(small) mcolor(black) ///
xtitle("Estimated difference in differences", size(small)) ytitle("", size(small)) ///
xlabel(, nogrid labsize(small)) ylabel(, nogrid labsize(small)) xsca(titlegap(2)) ///
swapnames legend(off) recast(bar) barwidth(0.25) color(blue) fcolor(*.5) citop coeflabels(,wrap(15)) 


